<template>

    <div class="app-container" v-if="canList">
        <div class="filter-container">
            <!--            <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item input"-->
            <!--                      placeholder="上传者的ID"-->
            <!--                      v-model="listQuery.userId">-->
            <!--            </el-input>-->
            <!--      <el-input v-if="!isWg && roleId.indexOf(18) == -1" @keyup.enter.native="handleFilter" style="width: 200px;"-->
            <!--                class="filter-item input"-->
            <!--                placeholder="店铺名称1"-->
            <!--                v-model="listQuery.shopName">-->
            <!--      </el-input>-->

            <!--      <el-select  @change='handleFilter' clearable class="filter-item input" style="width: 130px"-->
            <!--                  v-model="listQuery.limitPayWay"-->
            <!--                  placeholder="限制支付">-->
            <!--        <el-option v-for="(item,index) in  limitPayWay" :key="item" :label="item" :value="index">-->
            <!--        </el-option>-->
            <!--      </el-select>-->

            <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item input"
                      placeholder="商品名称"
                      v-model="listQuery.name">
            </el-input>

            <!--      <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item input"-->
            <!--                placeholder="团队名称"-->
            <!--                v-model="listQuery.tCode">-->
            <!--      </el-input>-->
            <!--            <el-select @change='handleFilter' clearable class="filter-item input" style="width: 130px"-->
            <!--                       v-model="listQuery.openSku"-->
            <!--                       placeholder="开启规格">-->
            <!--                <el-option v-for="(item,index) in  openSkuOptions" :key="item" :label="item" :value="index">-->
            <!--                </el-option>-->
            <!--            </el-select>-->
            <el-select v-if="!isWg && userId != null" @change='handleFilter' clearable class="filter-item input"
                       style="width: 130px"
                       v-model="listQuery.shelf"
                       placeholder="库存上架">
                <el-option v-for="(item,index) in  adminShelfOptions" :key="item" :label="item" :value="index">
                </el-option>
            </el-select>
            <!--      <el-select v-if="!isWg && userId == null" @change='handleFilter' clearable class="filter-item input"-->
            <!--                 style="width: 130px"-->
            <!--                 v-model="listQuery.dailySel"-->
            <!--                 placeholder="每日优选">-->
            <!--        <el-option v-for="(item,index) in  dailySelOptions" :key="item" :label="item" :value="index">-->
            <!--        </el-option>-->
            <!--      </el-select>-->

            <el-select v-if="!isWg && userId == null" @change='handleFilter' clearable class="filter-item input"
                       style="width: 130px"
                       v-model="listQuery.shelf"
                       placeholder="库存上架">
                <el-option v-for="(item,index) in  adminShelfOptions" :key="item" :label="item" :value="index">
                </el-option>
            </el-select>

            <el-select v-if="userId == null" @change='handleFilter' clearable class="filter-item input"
                       style="width: 130px"
                       v-model="listQuery.saleType"
                       placeholder="售卖类型">
                <el-option v-for="(item,index) in  saleTypeOptions" :key="index" :label="item.name"
                           :value="item.id">
                </el-option>
            </el-select>
            <el-cascader
                    placeholder="分类"
                    :options="mallTypes"
                    @change="handleFilter"
                    :props="queryProp"
                    v-model="types"
                    clearable
                    filterable>
            </el-cascader>
            <el-button style="margin-left: 10px;" class="filter-item input" type="primary" v-waves icon="el-icon-search"
                       @click="handleFilter">查询
            </el-button>
            <el-button class="filter-item input" style="margin-left: 10px;" @click="handleCreate" type="primary"
                       v-if="canSave" icon="el-icon-circle-plus-outline">新增
            </el-button>
            <!--            <el-button class="filter-item input" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download"-->
            <!--                       @click="handleDownload">导出-->
            <!--            </el-button>-->
        </div>

        <el-table :key='tableKey' :data="list" v-loading="listLoading" border fit highlight-current-row
                  style="width: 100%;min-height:1000px;">
            <el-table-column align="center" label="序号">
                <template slot-scope="scope">
                    <span>{{ scope.row.id }}</span>
                </template>
            </el-table-column>
            <!--      <el-table-column align="center" label="店铺名称" width="150">-->
            <!--        <template slot-scope="scope">-->
            <!--          <span>{{ scope.row.shopEntity ? scope.row.shopEntity.name : getShopName }}</span>-->
            <!--        </template>-->
            <!--      </el-table-column>-->
            <!--            <el-table-column align="center" label="上传者的ID">-->
            <!--                <template slot-scope="scope">-->
            <!--                    <span>{{scope.row.userId}}</span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->
            <el-table-column align="center" label="商品名称" width="150">
                <template slot-scope="scope">
                    <span>{{ scope.row.name }}</span>
                </template>
            </el-table-column>
            <el-table-column align="center" label="商品简称" width="150">
                <template slot-scope="scope">
                    <span>{{ scope.row.remark }}</span>
                </template>
            </el-table-column>
            <el-table-column align="center" label="单位">
                <template slot-scope="scope">
                    <span>{{ scope.row.unit }}</span>
                </template>
            </el-table-column>
            <el-table-column align="center" label="虚拟销量">
                <template slot-scope="scope">
                    <span>{{ scope.row.sales }}</span>
                </template>
            </el-table-column>
            <el-table-column align="center" label="重量kg">
                <template slot-scope="scope">
                    <span>{{ scope.row.weight }}</span>
                </template>
            </el-table-column>
            <!--            <el-table-column align="center" label="描述">-->
            <!--                <template slot-scope="scope">-->
            <!--                    <span>{{scope.row.info}}</span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->
            <!--            <el-table-column align="center" label="分享标题">-->
            <!--                <template slot-scope="scope">-->
            <!--                    <span>{{scope.row.title}}</span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->
            <!--            <el-table-column align="center" label="原价">-->
            <!--                <template slot-scope="scope">-->
            <!--                    <span>{{scope.row.oldPrice}}</span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->
            <el-table-column align="center" label="现价">
                <template slot-scope="scope">
                    <span>{{ scope.row.nowPrice }}</span>
                </template>
            </el-table-column>
            <!--            <el-table-column align="center" label="成本价">-->
            <!--                <template slot-scope="scope">-->
            <!--                    <span>{{scope.row.primePrice}}</span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->

            <!-- <el-table-column align="center" label="库存">
                <template slot-scope="scope">
                    <span>{{scope.row.stock}}</span>
                </template>
            </el-table-column> -->
            <!--            <el-table-column align="center" label="开启规格">-->
            <!--                <template slot-scope="scope">-->
            <!--                                                <span>-->

            <!--                         <el-tag :type="tagTypes[scope.row.openSku]">     {{openSkuOptions[scope.row.openSku]} }</el-tag>-->

            <!--                        </span>-->
            <!--                </template>-->
            <!--            </el-table-column>-->
            <el-table-column align="center" label="是否上架">
                <template slot-scope="scope">
                                                <span>

                         <el-tag
                                 :type="tagTypes[scope.row.shelf]">     {{
                             adminShelfOptions[scope.row.shelf]
                             }}</el-tag>

                        </span>
                </template>
            </el-table-column>
            <el-table-column align="center" label="排序">
                <template slot-scope="scope">
                    <span>{{ scope.row.sort }}</span>
                </template>
            </el-table-column>

            <!--      <el-table-column v-if="userId == null" align="center" label="售卖类型">-->
            <!--        <template slot-scope="scope">-->
            <!--                          <span>-->
            <!--                          {{ saleTypeOptions[scope.row.saleType] }}-->
            <!--                        </span>-->
            <!--        </template>-->
            <!--      </el-table-column>-->


            <el-table-column align="center" label="操作" width="230" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button type="warning" v-if="canUpdate" size="mini" @click="handleStock(scope)">入库
                    </el-button>
                    <el-button type="primary" v-if="canUpdate" size="mini" @click="handleUpdate(scope.row)">编辑
                    </el-button>
                    <el-button v-if="canSave" size="mini" type="danger"
                               @click="handleDelete(scope.row)">删除
                    </el-button>
                    <!--<el-button v-if="!userId" style="margin-top: 5px"  size="mini" type="danger"
                              @click="goAct(scope.row)">活动
                   </el-button>-->
                </template>
            </el-table-column>

        </el-table>

        <div class="pagination-container">
            <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                           :current-page="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit"
                           layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </div>

        <el-dialog title="入库" :visible.sync="dialogStockVisible">
            <el-form ref="dataForm" label-position="left"
                     style='width: 50%; margin-left:20%;' label-width="80px">
                <el-form-item label="商品名字" prop="name">
                    <el-input disabled v-model="stock.goodsName"></el-input>
                </el-form-item>
                <el-form-item label="产品SKU" prop="name" v-if="temp.mallSkus&&temp.mallSkus.length>0">
                    <el-select @change="changeStockSku" v-model="stock.skuName" placeholder="请选择">
                        <el-option
                                v-for="item in temp.mallSkus"
                                :key="item.name"
                                :label="item.name"
                                :value="item.name">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="库存" prop="unit">
                    <el-input type="number" disabled v-model="stock.oldQuantity"></el-input>
                </el-form-item>
                <el-form-item label="增量" prop="unit">
                    <el-input type="number" v-model="stock.quantity"></el-input>
                </el-form-item>
                <el-form-item label="备注" prop="unit">
                    <el-input type="textarea" v-model="stock.remark"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogStockVisible=false">取消</el-button>
                <el-button @click="updateStock" type="primary">确认</el-button>
            </div>
        </el-dialog>

        <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="65%">

            <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px"
                     style='width: 70%; margin-left:50px;'>
                <!--                <el-form-item label="上传者的ID" prop="userId">-->
                <!--                    <el-input v-model="temp.userId"></el-input>-->
                <!--                </el-form-item>-->

                <!--                <el-form-item  label="店铺名称:">
                                    <el-input disabled :value="list?list[0].shopEntity.name:getShopName"></el-input>
                                </el-form-item>-->
                <el-form-item label="商品名称:" prop="name">
                    <el-input v-model="temp.name"></el-input>
                </el-form-item>
                <el-form-item label="商品简称:" prop="name">
                    <el-input v-model="temp.remark"></el-input>
                </el-form-item>
                <el-form-item label="不可购买级别:">
                  <el-input v-model="temp.levelName"></el-input>
                </el-form-item>

                <!--        <el-form-item label="商品分类:" prop="" :show-all-levels="false">-->
                <!--          <el-cascader-->
                <!--              collapse-tags-->
                <!--              v-model="fenLeiTypes"-->
                <!--              :options="mallTypes"-->
                <!--              :props="props"-->
                <!--              @change="handleChange"-->
                <!--              clearable></el-cascader>-->
                <!--          &lt;!&ndash;  <el-select v-model="flTypes" multiple placeholder="产品分类" >-->
                <!--                <el-option-->
                <!--                        v-for="item in  mallTypes"-->
                <!--                        :key="item.id"-->
                <!--                        :label="item.name"-->
                <!--                        :value="item.id">-->
                <!--                </el-option>-->
                <!--            </el-select>&ndash;&gt;-->
                <!--        </el-form-item>-->

                <!--        <el-form-item label="商品分类2:" prop="" :show-all-levels="false">-->

                <!--            <el-select v-model="temp.type"  placeholder="产品分类" >-->
                <!--                <el-option-->
                <!--                        v-for="item in  mallTypes"-->
                <!--                        :key="item.id"-->
                <!--                        :label="item.name"-->
                <!--                        :value="item.id">-->
                <!--                </el-option>-->
                <!--            </el-select>-->
                <!--        </el-form-item>-->


                <el-form-item label="售卖类型:" prop="saleType">
                    <el-select @change="selectPrice" class="filter-item" v-model="temp.saleType" placeholder="售卖类型">
                        <el-option v-for="(item,index) in  saleTypeOptions" :key="index" :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <div class="levels" style="width: 130%;margin-bottom: 20px">
                    <!-- <el-form-item label="必需积分" prop="nowPrice">
                         <el-input placeholder="必需积分" v-model="saleTypeInfoEntity.point"></el-input>
                     </el-form-item>-->
                    <el-form-item label="可使用现金券" prop="">
                        <el-input placeholder="可抵扣现金券百分比" v-model="saleTypeInfoEntity.maxCash"></el-input>
                    </el-form-item>
                    <el-form-item label="可抵扣优惠券">
                        <el-input placeholder="最高可抵扣优惠券" v-model="saleTypeInfoEntity.maxCoupon"></el-input>
                    </el-form-item>

<!--                    <el-form-item label="采购价" prop="shopPrice">-->
<!--                        <el-input v-model="temp.shopPrice"-->
<!--                                  onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"></el-input>-->
<!--                    </el-form-item>-->
                    <!--            <el-form-item :label="temp.shopPrice?'分享奖励换购劵(最低:'+temp.shopPrice*100/1000+')':'分享奖励换购劵(最低:'+0+')'" prop="">-->
                    <!--              <el-input placeholder="分享奖励换购劵" v-model="saleTypeInfoEntity.voucherReward"></el-input>-->
                    <!--            </el-form-item>-->
                    <!--            <el-form-item :label="temp.shopPrice?'分享奖励代金劵(最低:'+temp.shopPrice*100/1000+')':'分享奖励代金劵(最低:'+0+')'" prop="">-->
                    <!--              <el-input placeholder="分享奖励代金劵" v-model="saleTypeInfoEntity.cashReward"></el-input>-->
                    <!--            </el-form-item>-->
<!--                    <el-form-item label="分享奖励换购劵" prop="">-->
<!--                        <el-input placeholder="分享奖励换购劵" v-model="saleTypeInfoEntity.voucherReward"></el-input>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item label="分享奖励代金劵" prop="">-->
<!--                        <el-input placeholder="分享奖励代金劵" v-model="saleTypeInfoEntity.cashReward"></el-input>-->
<!--                    </el-form-item>-->
                    <el-form-item v-if="userId == null" label="分享奖励优惠券" prop="">
                        <el-input placeholder="分享奖励优惠券" v-model="saleTypeInfoEntity.couponReward"></el-input>
                    </el-form-item>
<!--                    <el-form-item label="可抵扣清货券">-->
<!--                        <el-input placeholder="可抵扣清货券" v-model="saleTypeInfoEntity.maxClear"></el-input>-->
<!--                    </el-form-item>-->
                    <!--<el-form-item v-if="temp.saleType == 2" label="限购数量">
                        <el-input placeholder="限购数量" v-model="act.number"></el-input>
                    </el-form-item>-->
                </div>
<!--                <el-form-item v-if="userId == null" label="赠送清货券:" prop="">-->
<!--                    <el-input placehorelder="赠送清货券" v-model="saleTypeInfoEntity.clearReward"></el-input>-->
<!--                </el-form-item>-->
                <!--        <el-form-item v-if="userId == null" label="可抵扣优惠券" >-->
                <!--          <el-input placeholder="最高可抵扣优惠券" v-model="saleTypeInfoEntity.maxCoupon"></el-input>-->
                <!--        </el-form-item>-->
                <!--                <el-form-item label="捆绑产品" prop="goodsId">-->
                <!--                    &lt;!&ndash;                    <el-input v-model="temp.goodsId"></el-input>&ndash;&gt;-->
                <!--                    <el-select v-model="act.bindGoodsId" clearable filterable placeholder="请选择">-->
                <!--                        <el-option-->
                <!--                                v-for="item in goodsList"-->
                <!--                                :key="item.id"-->
                <!--                                :label="item.name"-->
                <!--                                :value="item.id">-->
                <!--                        </el-option>-->
                <!--                    </el-select>-->
                <!--                </el-form-item>-->
                <!--                <el-form-item label="捆绑数量" prop="number">-->
                <!--                    <el-input v-model="act.bindGoodsQuantity"></el-input>-->
                <!--                </el-form-item>-->


                <!--                <el-form-item label="禁购级别" prop="level" size="medium">-->
                <!--                    <el-select v-model="act.levels" clearable multiple placeholder="请选择" width="100px">-->
                <!--                        <el-option-->
                <!--                                v-for="item in levelList"-->
                <!--                                :key="item.id"-->
                <!--                                :label="item.name"-->
                <!--                                :value="item.name">-->
                <!--                        </el-option>-->
                <!--                    </el-select>-->
                <!--                </el-form-item>-->
<!--                <el-form-item v-if="temp.saleType == 2" label="限购数量" prop="number">-->
<!--                    <el-input v-model="act.number"></el-input>-->
<!--                </el-form-item>-->
                <!--                <el-form-item label="活动库存" prop="stock">-->
                <!--                    <el-input v-model="act.stock"></el-input>-->
                <!--                </el-form-item>-->

                <div class="levels" style="width: 130%;margin-bottom: 20px" v-if="temp.openLevelPrice">
                    <div v-for="(prices,idx) in pricesList" :key="new Date().getTime()">
                        <el-tag type="success" @click="addPrices">添加</el-tag>
                        <el-tag type="info" @click="removePrices(idx)">删除</el-tag>
                        <el-table

                                :key="idx"
                                :data="[1,2,3,4,5,6]"
                                border
                                style="width: 100%">
                            <el-table-column
                                    align="center"
                                    label="级别"
                            >
                                <template slot-scope="scope">
                                    <span v-if="scope.$index==0">价格</span>
                                    <span v-if="scope.$index==1">共享利润</span>
                                    <span v-if="scope.$index==2">购物级别</span>
                                    <span v-if="scope.$index==3">服务补贴</span>
                                    <span v-if="scope.$index==4">是否默认</span>
                                    <span v-if="scope.$index==5">团队编码</span>
                                </template>
                            </el-table-column>
                            <el-table-column v-for="(price,index) in prices" :key="index"
                                             align="center"
                                             :label="price.levelName"
                            >

                                <template slot-scope="scope">
                                    <el-input v-if="scope.$index==0" :disabled="userId"
                                              v-model="price.price"></el-input>
                                    <el-input v-if="scope.$index==1" :disabled="userId"
                                              v-model="price.profit"></el-input>
                                    <el-input v-if="scope.$index==2" :disabled="userId" v-model="price.vip"></el-input>
                                    <el-input v-if="scope.$index==3" :disabled="userId"
                                              v-model="price.vipProfit"></el-input>
                                    <el-input v-if="scope.$index==4" :disabled="userId" v-model="price.def"></el-input>
                                    <el-input v-if="scope.$index==5" :disabled="userId"
                                              v-model="price.vipCode"></el-input>
                                </template>
                            </el-table-column>

                        </el-table>
                    </div>
                </div>
                <el-form-item label="现价:" prop="nowPrice">
                    <el-input v-model="temp.nowPrice"></el-input>
                </el-form-item>

                <el-form-item label="开启级别价格" prop="status">
                    <el-select class="filter-item input" v-model="temp.openLevelPrice" placeholder="开启级别价格">
                        <el-option v-for="(item,index) in  openPriceOptions" :key="item" :label="item"
                                   :value="index">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="原价:" prop="oldPrice">
                    <el-input v-model="temp.oldPrice"></el-input>
                </el-form-item>
                <el-form-item v-if="!userId" label="计算标底" >
                    <el-input v-model="temp.profit"></el-input>
                </el-form-item>
                <el-form-item v-if="!userId" label="模式" >
                    <el-input v-model="temp.mode"></el-input>
                </el-form-item>
                <el-form-item label="原库存:" prop="oldPrice">
                    <el-input v-model="temp.totalStock"></el-input>
                </el-form-item>
<!--                <el-form-item v-if="temp.saleType == 1" label="供货价:" :prop="userId?'supplyPrice':''">-->
<!--                    <el-input v-model="temp.supplyPrice"></el-input>-->
<!--                </el-form-item>-->
<!--                <el-form-item v-if="!userId" label="领导人密码:" prop="primePrice">-->
<!--                    <el-input v-model="temp.profitPaw"></el-input>-->
<!--                </el-form-item>-->
                <el-form-item v-if="!userId" label="团队编号" prop="tCode">
                    <el-input v-model="temp.tCode"></el-input>
                </el-form-item>
                <!--        <el-form-item v-if="!userId" label="触发级别" prop="vipLevel">-->
                <!--          <el-input v-model="temp.vipLevel"></el-input>-->
                <!--        </el-form-item>-->
                <!--        <el-form-item v-if="!userId" label="VIP利润" prop="vipProfit">-->
                <!--          <el-input v-model="temp.vipProfit"></el-input>-->
                <!--        </el-form-item>-->
                <!--        <el-form-item v-if="!userId" label="负责人奖励" prop="" :show-all-levels="false">-->
                <!--          <el-select v-model="temp.vip"  placeholder="是否奖励" >-->
                <!--            <el-option-->
                <!--                v-for="(item,index) in  options"-->
                <!--                :key="index"-->
                <!--                :label="item"-->
                <!--                :value="index">-->
                <!--            </el-option>-->
                <!--          </el-select>-->
                <!--        </el-form-item>-->


<!--                <el-form-item v-if="!userId" label="奖金池利润" prop="primePrice">-->
<!--                    <el-input v-model="temp.vipProfit"></el-input>-->
<!--                </el-form-item>-->

<!--                <el-form-item v-if="!userId" label="限制支付" prop="" :show-all-levels="false">-->

<!--                    <el-select v-model="temp.limitPayWay" placeholder="是否限制">-->
<!--                        <el-option-->
<!--                                v-for="(item,index) in  limitPayWay"-->
<!--                                :key="index"-->
<!--                                :label="item"-->
<!--                                :value="index">-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </el-form-item>-->

<!--                <div v-if="temp.saleType != 17">-->

<!--                    <el-form-item v-if="userId != null" label="区域服务津贴" prop="managerReward">-->
<!--                        省-->
<!--                        <el-input disabled style="width: 80px;white-space:nowrap" placeholder="省"-->
<!--                                  v-model="province"></el-input>-->
<!--                        市-->
<!--                        <el-input disabled style="width: 80px;margin-left: 5px" placeholder="市"-->
<!--                                  v-model="city"></el-input>-->
<!--                        区-->
<!--                        <el-input disabled style="width: 80px;margin-left: 5px" placeholder="区"-->
<!--                                  v-model="area"></el-input>-->
<!--                        ‰-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-else label="区域服务津贴" prop="managerReward">-->
<!--                        省-->
<!--                        <el-input style="width: 80px;white-space:nowrap" placeholder="省" v-model="province"></el-input>-->
<!--                        市-->
<!--                        <el-input style="width: 80px;margin-left: 5px" placeholder="市" v-model="city"></el-input>-->
<!--                        区-->
<!--                        <el-input style="width: 80px;margin-left: 5px" placeholder="区" v-model="area"></el-input>-->
<!--                        ‰-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="userId != null" label="店铺服务津贴" prop="">-->
<!--                        <el-input disabled style="width: 80px" v-model.number="shopReward"></el-input>-->
<!--                        <span>%</span>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-else label="店铺服务津贴" prop="nowPrice">-->
<!--                        <el-input style="width: 80px" v-model.number="shopReward"></el-input>-->
<!--                        <span>%</span>-->
<!--                    </el-form-item>-->
<!--                </div>-->
<!--                <el-form-item label="分享标题:" prop="title">-->
<!--                    <el-input v-model="temp.title"></el-input>-->
<!--                </el-form-item>-->
<!--                <div style="display: flex">-->
<!--                    <div>-->
<!--                        <el-form-item v-if="!isWg" label="产品分享信息:" prop="info">-->
<!--                            <el-select @change="handleAct" class="filter-item input" v-model="goodsShare"-->
<!--                                       placeholder="分享信息">-->
<!--                                <el-option v-for="(item,index) in  goodsShareOptions" :key="item" :label="item"-->
<!--                                           :value="index">-->
<!--                                </el-option>-->
<!--                            </el-select>-->
<!--                        </el-form-item>-->
<!--                        <el-form-item v-if="goodsShare == 0" label="优惠描述" prop="info">-->
<!--                            <el-input style="width: 190px" v-model="temp.discountInfo"-->
<!--                                      placeholder="优惠描述四个字内"></el-input>-->
<!--                        </el-form-item>-->
<!--                        <el-form-item v-if="goodsShare == 0" label="优惠价格" prop="info">-->
<!--                            <el-input style="width: 190px" v-model="temp.discountPrice"-->
<!--                                      onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"-->
<!--                                      placeholder="优惠价格三位数内"></el-input>-->
<!--                        </el-form-item>-->
<!--                        <el-form-item v-if="goodsShare == 0" label="活动信息" prop="info">-->
<!--                            <el-input style="width: 190px" v-model="temp.actInfo"-->
<!--                                      placeholder="活动信息八个字内"></el-input>-->
<!--                        </el-form-item>-->
<!--                        <el-form-item v-if="goodsShare == 1" label="卖点主题" prop="info">-->
<!--                            <el-input style="width: 190px" v-model="temp.buyTheme"-->
<!--                                      placeholder="卖点主题四个字内"></el-input>-->
<!--                        </el-form-item>-->
<!--                        <el-form-item v-if="goodsShare == 1" label="卖点信息" prop="info">-->
<!--                            <el-input style="width: 190px" v-model="temp.buyInfo"-->
<!--                                      placeholder="卖点信息八个字内"></el-input>-->
<!--                        </el-form-item>-->
<!--                    </div>-->
<!--                    <div v-if="goodsShare == 0">-->
<!--                        <img style="width: 200px;height: 300px" src="../../../assets/huodongxinxi.png"/>-->
<!--                        <div style="margin-left: 20px;color: red">示例图片</div>-->
<!--                    </div>-->
<!--                    <div v-if="goodsShare == 1">-->
<!--                        <img style="width: 200px;height: 300px" src="../../../assets/maidian.png"/>-->
<!--                        <div style="margin-left: 20px;color: red">示例图片</div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <el-form-item label="描述:" prop="info">-->
<!--                    <el-input type="textarea" v-model="temp.info"></el-input>-->
<!--                </el-form-item>-->
                <!--<el-form-item label="产品分享海报:" prop="postImg">
                    <el-upload
                            ref="postImgUpload"
                            action="http://up-z2.qiniup.com"
                            :auto-upload="true"
                            list-type="picture-card"
                            :on-preview="handlePictureCardPreview"
                            :before-upload="handleUpload"
                            :on-success="handlepostImgUploadSuccess"
                            :data="qData"
                            :file-list="postImgList"
                            :on-remove="handlepostImgRemove">
                        <i class="el-icon-plus"></i>
                    </el-upload>
                </el-form-item>-->
                <el-form-item label="开启规格" prop="status">
                    <el-select class="filter-item input" v-model="temp.openSku" placeholder="开启规格">
                        <el-option v-for="(item,index) in  openSkuOptions" :key="item" :label="item"
                                   :value="index">
                        </el-option>
                    </el-select>
                </el-form-item>
                <Sku :qData="qData" v-if="dialogFormVisible&&temp.openSku" :skuThemes="temp.skuThemes"
                     :mallSkus="temp.mallSkus" @updateSku="updateSku">
                </Sku>
<!--                <el-form-item v-if="!userId" label="开启每日优选" prop="status">-->
<!--                    <el-select class="filter-item input" v-model="temp.dailySel" placeholder="开启每日优选">-->
<!--                        <el-option v-for="(item,index) in  dailySelOptions" :key="item" :label="item"-->
<!--                                   :value="index">-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </el-form-item>-->

<!--                <el-form-item v-if="!userId" label="开启轮播" prop="status">-->
<!--                    <el-select class="filter-item input" v-model="temp.dailySelRotation" placeholder="开启每日优选轮播">-->
<!--                        <el-option v-for="(item,index) in  dailySelOptions" :key="item" :label="item"-->
<!--                                   :value="index">-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </el-form-item>-->

                <el-form-item v-if="!userId" label="设置可见:" prop="status">
                    <el-select class="filter-item input" v-model="temp.display" placeholder="设置可见">
                        <el-option v-for="(item,index) in  dispalyOptions" :key="item" :label="item"
                                   :value="index">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="生产日期:" :prop="userId ? 'createTime':''">
                    <el-date-picker v-model="temp.createTime" type="datetime"
                                    value-format="yyyy-MM-dd HH:mm:ss" placeholder="生产日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="保质期:" :prop="userId ? 'createTime':''">
                    <el-input v-model="temp.guaranty"></el-input>
                </el-form-item>
                <el-form-item label="单位/规格(如：盒、件)):" prop="unit">
                    <el-input v-model="temp.unit"></el-input>
                </el-form-item>


                <!--                <el-form-item label="过期时间" prop="expDate">-->
                <!--                    <el-input v-model="temp.expDate"></el-input>-->
                <!--                </el-form-item>-->

<!--                <el-form-item label="物流规则:" prop="logType">-->
<!--                    <el-select class="filter-item" v-model="temp.logType" placeholder="物流规则">-->
<!--                        <el-option v-for="(item,index) in  logTypeOptions" :key="item" :label="item"-->
<!--                                   :value="index">-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </el-form-item>-->
                <el-form-item v-if="temp.logType==1" label="满免数量" prop="fullNumber">
                    <el-input v-model="temp.fullNumber"></el-input>
                </el-form-item>

                <el-form-item v-if="temp.logType==1" label="未满邮费" prop="logFee">
                    <el-input v-model="temp.logFee"></el-input>
                </el-form-item>

                <el-form-item v-if="temp.logType==2" label="产品重量kg" prop="weight">
                    <el-input v-model="temp.weight"></el-input>
                </el-form-item>
                <el-form-item v-if="temp.logType==2" label="每箱数量" prop="perBox">
                    <el-input v-model="temp.perBox"></el-input>
                </el-form-item>
                <el-form-item v-if="userId != null && temp.logType == 2" label="物流模板" prop="">
                    <el-select v-if="shopLogTemList.length > 0" class="filter-item" v-model="temp.logTemId"
                               placeholder="物流模板">
                        <el-option v-for="(item) in  shopLogTemList" :key="item.id" :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                    <el-select v-else @change="selectChange" class="filter-item" v-model="temp.logTemId"
                               placeholder="物流模板">
                        <el-option v-for="(item,index) in  shopLogTems" :key="index" :label="item"
                                   :value="index">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item v-if="!userId" label="排序:" prop="sort">
                    <el-input v-model="temp.sort"></el-input>
                </el-form-item>
                <div v-if="!userId">
                    <el-form-item label="是否转货" prop="status">
                        <el-select class="filter-item" v-model="saleTypeInfoEntity.transfer" placeholder="是否转货">
                            <el-option v-for="(item,index) in  options" :key="item" :label="item"
                                       :value="index">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否发货">
                        <el-select class="filter-item" v-model="saleTypeInfoEntity.delivery" placeholder="是否发货">
                            <el-option v-for="(item,index) in  options" :key="item" :label="item"
                                       :value="index">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </div>
                <el-form-item label="库存">
                     <el-input disabled v-model="temp.stock"></el-input>
                 </el-form-item>

                <el-form-item v-if="!userId" label="是否上架" prop="status">
                    <el-select class="filter-item input" v-model="temp.shelf" placeholder="是否上架">
                        <el-option v-for="(item,index) in  adminShelfOptions" :key="item" :label="item"
                                   :value="index"
                                   :disabled="userId != null && index==1?true:false">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item v-else label="是否上架" prop="status">
                    <el-select class="filter-item input" v-model="temp.shelf" placeholder="是否上架">
                        <el-option v-if="item !=''" v-for="(item,index) in  shelfOptions" :key="index" :label="item"
                                   :value="index">
                        </el-option>
                    </el-select>
                </el-form-item>
<!--                <el-form-item label="品牌名称:" prop="brandName">-->
<!--                    <el-input v-model="goodsTemp.brandName" placeholder="请填写品牌名称"></el-input>-->
<!--                </el-form-item>-->
<!--                <el-form-item label="品牌简介:" prop="brandInfo">-->
<!--                    <el-input v-model="goodsTemp.brandInfo" placeholder="请填写品牌简介"></el-input>-->
<!--                </el-form-item>-->
<!--                <div v-if="!isWg">-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(47) > -1|| this.bigTypes.indexOf(48) > -1|| this.bigTypes.indexOf(415) > -1"-->
<!--                            label="生产企业卫生许可证" prop="companyhealthLicense">-->

<!--                        <UnloadImg-->
<!--                                :list="companyHealthLicenseList"-->
<!--                                :onSuccess="handlecompanyhealthLicenseUploadSuccess"-->
<!--                                @update="companyHealthLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(47) > -1 || this.bigTypes.indexOf(61) > -1|| this.bigTypes.indexOf(46) > -1|| this.bigTypes.indexOf(55) > -1|| this.bigTypes.indexOf(415) > -1"-->
<!--                            label="生产许可证" prop="produceLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="produceLicenseList"-->
<!--                                :onSuccess="handleproduceLicenseUploadSuccess"-->
<!--                                @update="produceLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(47) > -1 || this.bigTypes.indexOf(61) > -1|| this.bigTypes.indexOf(46) > -1|| this.bigTypes.indexOf(55) > -1|| this.bigTypes.indexOf(415) > -1"-->
<!--                            label="经营许可证" prop="manageLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="manageLicenseList"-->
<!--                                :onSuccess="handlemanageLicenseUploadSuccess"-->
<!--                                @update="manageLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(47) > -1||this.bigTypes.indexOf(42) > -1||this.bigTypes.indexOf(46) > -1||this.bigTypes.indexOf(55) > -1"-->
<!--                            label="备案登记" prop="manageLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="recordTableList"-->
<!--                                :onSuccess="handlerecordTableUploadSuccess"-->
<!--                                @update="recordTableList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.length > 0" label="销售授权书" prop="manageLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="salesAuthorizationList"-->
<!--                                :onSuccess="handlesalesAuthorizationUploadSuccess"-->
<!--                                @update="salesAuthorizationList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(61) > -1||this.bigTypes.indexOf(415) > -1"-->
<!--                                  label="产品加工协议"-->
<!--                                  prop="manageLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="productAgreementList"-->
<!--                                :onSuccess="handleproductAgreementUploadSuccess"-->
<!--                                @update="productAgreementList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->

<!--                    <el-form-item v-if="this.bigTypes.indexOf(60) > -1" label="保健食品GMP证书" prop="gmpLicense">-->


<!--                        <UnloadImg-->
<!--                                :list="gmpLicenseList"-->
<!--                                :onSuccess="handlegmpLicenseUploadSuccess"-->
<!--                                @update="gmpLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.length > 0" label="商标注册证">-->


<!--                        <UnloadImg-->
<!--                                :list="trademarkLicenseList"-->
<!--                                :onSuccess="handletrademarkLicenseUploadSuccess"-->
<!--                                @update="trademarkLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if=" this.bigTypes.indexOf(54) > -1 || this.bigTypes.indexOf(44) > -1|| this.bigTypes.indexOf(48) > -1|| this.bigTypes.indexOf(58) > -1|| this.bigTypes.indexOf(42) > -1|| this.bigTypes.indexOf(46) > -1-->
<!--|| this.bigTypes.indexOf(52) > -1|| this.bigTypes.indexOf(53) > -1|| this.bigTypes.indexOf(57) > -1"-->
<!--                                  label="成品检测报告（由国家认定的具有CNAS与CMA资质的第三方质检机构出具的检测报告）">-->


<!--                        <UnloadImg-->
<!--                                :list="goodsProveList"-->
<!--                                :onSuccess="handlegoodsProveUploadSuccess"-->
<!--                                @update="goodsProveList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if=" this.bigTypes.indexOf(41) > -1" label="非特殊用途化妆品备案">-->


<!--                        <UnloadImg-->
<!--                                :list="recordTableList"-->
<!--                                :onSuccess="handlerecordTableUploadSuccess"-->
<!--                                @update="recordTableList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(41) > -1 || this.bigTypes.indexOf(47) > -1|| this.bigTypes.indexOf(415) > -1"-->
<!--                            label="商品质量保证书">-->


<!--                        <UnloadImg-->
<!--                                :list="qualityGuarantyList"-->
<!--                                :onSuccess="handlequalityGuarantyUploadSuccess"-->
<!--                                @update="qualityGuarantyList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if=" this.bigTypes.indexOf(54) > -1 || this.bigTypes.indexOf(45) > -1 || this.bigTypes.indexOf(41) > -1"-->
<!--                            label="完整的销售授权">-->


<!--                        <UnloadImg-->
<!--                                :list="salesAuthorizationList"-->
<!--                                :onSuccess="handlesalesAuthorizationUploadSuccess"-->
<!--                                @update="salesAuthorizationList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if=" this.bigTypes.length > 0"-->
<!--                                  label="进口货物报关单复印件（若经营进口商品，需提交该品牌中华人民共和国）">-->


<!--                        <UnloadImg-->
<!--                                :list="goodsDeclarationList"-->
<!--                                :onSuccess="handlegoodsDeclarationUploadSuccess"-->
<!--                                @update="goodsDeclarationList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(41) > -1||this.bigTypes.indexOf(55) > -1"-->
<!--                                  label="入境货物检验检疫证明（若经营进口商品，需提交该品牌中华人民共和国）">-->


<!--                        <UnloadImg-->
<!--                                :list="testProveList"-->
<!--                                :onSuccess="handletestProveUploadSuccess"-->
<!--                                @update="testProveList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(45) > -1 || this.bigTypes.indexOf(41) > -1 || this.bigTypes.indexOf(47) > -1 || this.bigTypes.indexOf(44) > -1"-->
<!--                            label="产品加工协议">-->

<!--                        <UnloadImg-->
<!--                                :list="productAgreementList"-->
<!--                                :onSuccess="handleproductAgreementUploadSuccess"-->
<!--                                @update="productAgreementList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(47) > -1 || this.bigTypes.indexOf(61) > -1  || this.bigTypes.indexOf(415) > -1"-->
<!--                            label="食品流通许可证">-->

<!--                        <UnloadImg-->
<!--                                :list="circulateLicenseList"-->
<!--                                :onSuccess="handlecirculateLicenseUploadSuccess"-->
<!--                                @update="circulateLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1 ||this.bigTypes.indexOf(61) > -1 || this.bigTypes.indexOf(45) > -1 || this.bigTypes.indexOf(41) > -1 || this.bigTypes.indexOf(47) > -1|| this.bigTypes.indexOf(415) > -1"-->
<!--                            label="产品检测报告">-->

<!--                        <UnloadImg-->
<!--                                :list="detectPhotocopyList"-->
<!--                                :onSuccess="handledetectPhotocopyUploadSuccess"-->
<!--                                @update="detectPhotocopyList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(45) > -1 || this.bigTypes.indexOf(41) > -1 || this.bigTypes.indexOf(60) > -1|| this.bigTypes.indexOf(55) > -1"-->
<!--                            label="产品清单(若经营进口货物需提供,产品清单需与报关单产品保持一致性)">-->

<!--                        <UnloadImg-->
<!--                                :list="productListList"-->
<!--                                :onSuccess="handleproductListUploadSuccess"-->
<!--                                @update="productListList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(60) > -1"-->
<!--                                  label="进口保健食品批准证书(若经营进口货物需提供)">-->

<!--                        <UnloadImg-->
<!--                                :list="approveLicenseList"-->
<!--                                :onSuccess="handleapproveLicenseUploadSuccess"-->
<!--                                @update="approveLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(60) > -1||this.bigTypes.indexOf(46) > -1||this.bigTypes.indexOf(55) > -1"-->
<!--                            label="委托加工协议">-->

<!--                        <UnloadImg-->
<!--                                :list="entrustAgreementList"-->
<!--                                :onSuccess="handleentrustAgreementUploadSuccess"-->
<!--                                @update="entrustAgreementList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(41) > -1" label="化妆品生产企业卫生许可证">-->

<!--                        <UnloadImg-->
<!--                                :list="companyHealthLicenseList"-->
<!--                                :onSuccess="handlecompanyhealthLicenseUploadSuccess"-->
<!--                                @update="companyHealthLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(41) > -1 ||this.bigTypes.indexOf(58) > -1||this.bigTypes.indexOf(42) > -1||this.bigTypes.indexOf(55) > -1"-->
<!--                            label="全国工业生产许可证">-->


<!--                        <UnloadImg-->
<!--                                :list="industryLicenseList"-->
<!--                                :onSuccess="handleindustryLicenseUploadSuccess"-->
<!--                                @update="industryLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>&lt;!&ndash;-->
<!--                <el-form-item v-if="this.bigTypes.indexOf(45) > -1" label="国产花露水、驱虫产品、蚊香、杀蟑胶饵产品需提供农药产品生产许可证或全国工业生产许可证（农药产品和农药登记证（或者农药临时登记证）、生产单位营业执照">-->

<!--                    <el-upload-->
<!--                            ref="companybusImgUpload"-->
<!--                            action="http://up-z2.qiniup.com"-->
<!--                            :auto-upload="true"-->
<!--                            list-type="picture-card"-->
<!--                            :on-preview="handlePictureCardPreview"-->
<!--                            :before-upload="handleUpload"-->
<!--                            :on-success="handlecompanybusImgUploadSuccess"-->
<!--                            :data="qData"-->
<!--                            :file-list="companybusImgList"-->
<!--                            :on-remove="handlecompanybusImgRemove">-->
<!--                        <i class="el-icon-plus"></i>-->
<!--                    </el-upload>-->
<!--                </el-form-item>&ndash;&gt;-->
<!--                    &lt;!&ndash;   <el-form-item v-if="this.bigTypes.indexOf(45) > -1" label="国产餐具洗涤剂、清洁剂、保鲜膜等需提供全国工业生产许可证、生产商营业执照">-->

<!--                           <el-upload-->
<!--                                   ref="companybusImgUpload"-->
<!--                                   action="http://up-z2.qiniup.com"-->
<!--                                   :auto-upload="true"-->
<!--                                   list-type="picture-card"-->
<!--                                   :on-preview="handlePictureCardPreview"-->
<!--                                   :before-upload="handleUpload"-->
<!--                                   :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                   :data="qData"-->
<!--                                   :file-list="companybusImgList"-->
<!--                                   :on-remove="handlecompanybusImgRemove">-->
<!--                               <i class="el-icon-plus"></i>-->
<!--                           </el-upload>-->
<!--                       </el-form-item>-->
<!--                       <el-form-item v-if="this.bigTypes.indexOf(45) > -1" label="首次进口的消毒剂和消毒器械产品须提供针对具体产品型号的《卫生许可批件》">-->

<!--                           <el-upload-->
<!--                                   ref="companybusImgUpload"-->
<!--                                   action="http://up-z2.qiniup.com"-->
<!--                                   :auto-upload="true"-->
<!--                                   list-type="picture-card"-->
<!--                                   :on-preview="handlePictureCardPreview"-->
<!--                                   :before-upload="handleUpload"-->
<!--                                   :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                   :data="qData"-->
<!--                                   :file-list="companybusImgList"-->
<!--                                   :on-remove="handlecompanybusImgRemove">-->
<!--                               <i class="el-icon-plus"></i>-->
<!--                           </el-upload>-->
<!--                       </el-form-item>&ndash;&gt;-->
<!--                    &lt;!&ndash; <el-form-item v-if="this.bigTypes.indexOf(45) > -1 && this.bigTypes.indexOf(124) > -1" label="全国工业产品生产许可证或者牙膏生产企业卫生许可证、生产单位营业执照">-->

<!--                         <el-upload-->
<!--                                 ref="companybusImgUpload"-->
<!--                                 action="http://up-z2.qiniup.com"-->
<!--                                 :auto-upload="true"-->
<!--                                 list-type="picture-card"-->
<!--                                 :on-preview="handlePictureCardPreview"-->
<!--                                 :before-upload="handleUpload"-->
<!--                                 :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                 :data="qData"-->
<!--                                 :file-list="companybusImgList"-->
<!--                                 :on-remove="handlecompanybusImgRemove">-->
<!--                             <i class="el-icon-plus"></i>-->
<!--                         </el-upload>-->
<!--                     </el-form-item>&ndash;&gt;-->

<!--                    &lt;!&ndash;<el-form-item v-if="this.bigTypes.indexOf(45) > -1" label="具有抑菌、抗菌、杀菌功能的洗手液、消毒液(剂)等（消毒产品生产企业卫生许可证、生产单位营业执照）">-->

<!--                        <el-upload-->
<!--                                ref="companybusImgUpload"-->
<!--                                action="http://up-z2.qiniup.com"-->
<!--                                :auto-upload="true"-->
<!--                                list-type="picture-card"-->
<!--                                :on-preview="handlePictureCardPreview"-->
<!--                                :before-upload="handleUpload"-->
<!--                                :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                :data="qData"-->
<!--                                :file-list="companybusImgList"-->
<!--                                :on-remove="handlecompanybusImgRemove">-->
<!--                            <i class="el-icon-plus"></i>-->
<!--                        </el-upload>-->
<!--                    </el-form-item>&ndash;&gt;-->
<!--                    <el-form-item-->
<!--                            v-if="this.bigTypes.indexOf(45) > -1 || this.bigTypes.indexOf(44) > -1|| this.bigTypes.indexOf(48) > -1|| this.bigTypes.indexOf(58) > -1|| this.bigTypes.indexOf(42) > -1|| this.bigTypes.indexOf(55) > -1|| this.bigTypes.indexOf(43) > -1"-->
<!--                            label="CCC认证证书">-->

<!--                        <UnloadImg-->
<!--                                :list="cccLicenseList"-->
<!--                                :onSuccess="handlecccLicenseUploadSuccess"-->
<!--                                @update="cccLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(61) > -1"-->
<!--                                  label="动物防疫条件合格证、动物检验检疫、农产品卫生检疫合格证明">-->

<!--                        <UnloadImg-->
<!--                                :list="epidemicPreventionList"-->
<!--                                :onSuccess="handleepidemicPreventionUploadSuccess"-->
<!--                                @update="epidemicPreventionList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    &lt;!&ndash;                <el-form-item v-if="this.bigTypes.indexOf(61) > -1 || this.bigTypes.indexOf(60) > -1" label="产品检测报告">&ndash;&gt;-->
<!--                    &lt;!&ndash;                   &ndash;&gt;-->
<!--                    &lt;!&ndash;                    <el-upload&ndash;&gt;-->
<!--                    &lt;!&ndash;                            ref="detectPhotocopyUpload"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            action="http://up-z2.qiniup.com"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :auto-upload="true"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            list-type="picture-card"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :on-preview="handlePictureCardPreview"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :before-upload="handleUpload"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :on-success="handledetectPhotocopyUploadSuccess"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :data="qData"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :file-list="detectPhotocopyList"&ndash;&gt;-->
<!--                    &lt;!&ndash;                            :on-remove="handledetectPhotocopyRemove">&ndash;&gt;-->
<!--                    &lt;!&ndash;                        <i class="el-icon-plus"></i>&ndash;&gt;-->
<!--                    &lt;!&ndash;                    </el-upload>&ndash;&gt;-->
<!--                    &lt;!&ndash;                </el-form-item>&ndash;&gt;-->
<!--                    &lt;!&ndash;   <el-form-item v-if="this.bigTypes.indexOf(61) > -1 || this.bigTypes.indexOf(60) > -1" label="食品流通许可证或食品经营许可证">-->

<!--                           <el-upload-->
<!--                                   ref="companybusImgUpload"-->
<!--                                   action="http://up-z2.qiniup.com"-->
<!--                                   :auto-upload="true"-->
<!--                                   list-type="picture-card"-->
<!--                                   :on-preview="handlePictureCardPreview"-->
<!--                                   :before-upload="handleUpload"-->
<!--                                   :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                   :data="qData"-->
<!--                                   :file-list="companybusImgList"-->
<!--                                   :on-remove="handlecompanybusImgRemove">-->
<!--                               <i class="el-icon-plus"></i>-->
<!--                           </el-upload>-->
<!--                       </el-form-item>&ndash;&gt;-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(60) > -1 || this.bigTypes.indexOf(47) > -1"-->
<!--                                  label="品牌商的食品经营企业卫生许可证">-->

<!--                        <UnloadImg-->
<!--                                :list="manageHealthLicenseList"-->
<!--                                :onSuccess="handlemanagehealthLicenseUploadSuccess"-->
<!--                                @update="manageHealthLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->
<!--                    <el-form-item v-if="this.bigTypes.indexOf(60) > -1"-->
<!--                                  label="生产厂商的企业营业执照副本复印件(非生产厂商)">-->

<!--                        <UnloadImg-->
<!--                                :list="companyLicenseList"-->
<!--                                :onSuccess="handlecompanyLicenseUploadSuccess"-->
<!--                                @update="companyLicenseList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                    </el-form-item>-->

<!--                    &lt;!&ndash;  <el-form-item v-if="this.bigTypes.indexOf(61) > -1 || this.bigTypes.indexOf(41) > -1 || this.bigTypes.indexOf(60) > -1" label="商标注册证复印件或商标注册受理通知书">-->

<!--                          <el-upload-->
<!--                                  ref="companybusImgUpload"-->
<!--                                  action="http://up-z2.qiniup.com"-->
<!--                                  :auto-upload="true"-->
<!--                                  list-type="picture-card"-->
<!--                                  :on-preview="handlePictureCardPreview"-->
<!--                                  :before-upload="handleUpload"-->
<!--                                  :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                  :data="qData"-->
<!--                                  :file-list="companybusImgList"-->
<!--                                  :on-remove="handlecompanybusImgRemove">-->
<!--                              <i class="el-icon-plus"></i>-->
<!--                          </el-upload>-->
<!--                      </el-form-item>&ndash;&gt;-->
<!--                    &lt;!&ndash;      <el-form-item v-if="this.bigTypes.indexOf(41) > -1" label="进口非特化妆品备案">-->

<!--                              <el-upload-->
<!--                                      ref="companybusImgUpload"-->
<!--                                      action="http://up-z2.qiniup.com"-->
<!--                                      :auto-upload="true"-->
<!--                                      list-type="picture-card"-->
<!--                                      :on-preview="handlePictureCardPreview"-->
<!--                                      :before-upload="handleUpload"-->
<!--                                      :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                      :data="qData"-->
<!--                                      :file-list="companybusImgList"-->
<!--                                      :on-remove="handlecompanybusImgRemove">-->
<!--                                  <i class="el-icon-plus"></i>-->
<!--                              </el-upload>-->
<!--                          </el-form-item>&ndash;&gt;-->
<!--                    &lt;!&ndash;             <el-form-item v-if="this.bigTypes.indexOf(60) > -1" label="营业执照(应有生产经营保健品或预包装经营范围)">-->

<!--                                     <el-upload-->
<!--                                             ref="companybusImgUpload"-->
<!--                                             action="http://up-z2.qiniup.com"-->
<!--                                             :auto-upload="true"-->
<!--                                             list-type="picture-card"-->
<!--                                             :on-preview="handlePictureCardPreview"-->
<!--                                             :before-upload="handleUpload"-->
<!--                                             :on-success="handlecompanybusImgUploadSuccess"-->
<!--                                             :data="qData"-->
<!--                                             :file-list="companybusImgList"-->
<!--                                             :on-remove="handlecompanybusImgRemove">-->
<!--                                         <i class="el-icon-plus"></i>-->
<!--                                     </el-upload>-->
<!--                                 </el-form-item>&ndash;&gt;-->
<!--                    <el-form-item label="品牌方承诺书或授权书">-->
<!--                        <UnloadImg-->
<!--                                :list="brandAuthorizationList"-->
<!--                                :onSuccess="handlebrandAuthorizationUploadSuccess"-->
<!--                                @update="brandAuthorizationList=$event"-->
<!--                                @showImg="handlePictureCardPreview"-->
<!--                                :token="qData.token"-->
<!--                        ></UnloadImg>-->
<!--                        <a href="http://images.zmzpl.com/品牌方承诺书模板.docx"-->
<!--                           style="text-decoration:underline;color: blue">品牌承诺书模板.docx下载</a>-->
<!--                        <a href="http://images.zmzpl.com/授权书模板.docx"-->
<!--                           style="text-decoration:underline;color: blue;margin-left: 20px">授权书模板.docx下载</a>-->
<!--                    </el-form-item>-->
<!--                </div>-->

                <el-form-item label="产品缩略图:">
                    <UnloadImg
                            :list="imgList"
                            :onSuccess="handleimgUploadSuccess"
                            @update="imgList=$event"
                            @showImg="handlePictureCardPreview"
                            :token="qData.token"
                    ></UnloadImg>
                    <div class="uploadImg">最多上传1张375*375的图片 100k以内</div>
                </el-form-item>
                <el-form-item label="产品主图:">
                    <UnloadImg
                            :list="midImgList"
                            :onSuccess="handlemidImgUploadSuccess"
                            @update="midImgList=$event"
                            @showImg="handlePictureCardPreview"
                            :token="qData.token"
                    ></UnloadImg>
                    <div class="uploadImg">最多上传1张375*500的图片 100k以内</div>
                </el-form-item>
                <el-form-item label="产品详情图:">
                    <UnloadImg
                            :list="bigImgList"
                            :onSuccess="handlebigImgUploadSuccess"
                            @update="bigImgList=$event"
                            @showImg="handlePictureCardPreview"
                            :token="qData.token"
                    ></UnloadImg>
                    <div class="uploadImg">上传一张375*700的图 100k以内</div>
                </el-form-item>

                <el-dialog :visible.sync="dialogVisible" append-to-body>
                    <img width="100%" :src="dialogImageUrl" alt="">
                </el-dialog>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="closeDialogForm">取消</el-button>
                <el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确认</el-button>
                <el-button v-else type="primary" @click="updateData">确认</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<style type="stylus" lang="stylus">
.filter-container {
  /*padding-bottom: 20px;*/
}

.filter-item {
  margin-bottom: 10px;
}

.filter-item.input {
  /*line-height: 60px*/
  margin-right: 10px;
}

.uploadImg {
  color: red;
  font-size: 12px
}


</style>

<script>
import {list, save, update, remove, info, updateStock, listType} from '@/api/mall_goods'
import waves from '@/directive/waves' // 水波纹指令
import UnloadImg from '@/components/UnloadImg'
import {getList} from '@/api/shopLogTem'

import {getToken, domain} from '@/api/qiniu'
import {listToStrs, strsToList} from '@/utils/imgUtil'

import {mapGetters} from 'vuex'
import {hasAuth} from '@/utils/auth'
import Sku from '@/components/Sku'
import {listAll} from "../../../api/level";

export default {
    name: 'test',
    directives: {
        waves
    },
    components: {
        Sku, UnloadImg
    },
    data() {
        return {
            brandBusinessLicenseList: [],
            companyHealthLicenseList: [],
            manageHealthLicenseList: [],
            approveLicenseList: [],
            produceLicenseList: [],
            registerNoticeList: [],
            manageLicenseList: [],
            gmpLicenseList: [],
            trademarkLicenseList: [],
            productAgreementList: [],
            circulateLicenseList: [],
            betweenCirculateLicenseList: [],
            detectPhotocopyList: [],
            goodsDeclarationList: [],
            productListList: [],
            companyLicenseList: [],
            entrustAgreementList: [],
            qualityGuarantyList: [],
            healthPhotocopyList: [],
            fiveTrademarkList: [],
            recordTableList: [],
            epidemicPreventionList: [],
            industryLicenseList: [],
            salesAuthorizationList: [],
            testProveList: [],
            cccLicenseList: [],
            goodsProveList: [],
            brandAuthorizationList: [],
            bigTypes: [],
            userId: null,
            levels: null,
            tableKey: 0,
            list: null,
            total: null,
            listLoading: true,
            props: {multiple: true, label: "name", value: "id"},
            queryProp: {label: "name", value: "id"},
            mallTypes: [],
            fenLeiTypes: [],
            types: [],
            roleId: [],
            levelList: [],
            goodsList: [],
            province: null,
            city: null,
            area: null,
            shopReward: null,
            cashReward: null,
            voucherReward: null,
            clearReward: null,
            couponReward: null,
            maxCoupon: null,
            maxClear: null,
            act: {
                id: null,
                name: null,
                goodsId: null,
                bindGoodsId: null,
                bindGoodsQuantity: null,
                skuId: null,
                start: null,
                end: null,
                level: null,
                number: null,
                stock: null,
                status: null
            },
            goodsTemp: {
                id: null,
                userId: null,
                goodsId: null,
                brandName: null,
                brandInfo: null,
                brandBusinessLicense: null,
                companyHealthLicense: null,
                manageHealthLicense: null,
                approveLicense: null,
                produceLicense: null,
                registerNotice: null,
                manageLicense: null,
                gmpLicense: null,
                trademarkLicense: null,
                productAgreement: null,
                circulateLicense: null,
                betweenCirculateLicense: null,
                detectPhotocopy: null,
                goodsDeclaration: null,
                productList: null,
                companyLicense: null,
                entrustAgreement: null,
                qualityGuaranty: null,
                healthPhotocopy: null,
                fiveTrademark: null,
                recordTable: null,
                epidemicPrevention: null,
                industryLicense: null,
                salesAuthorization: null,
                testProve: null,
                cccLicense: null,
                goodsProve: null,
                brandAuthorization: null
            },
            goodsShare: null,
            listQuery: {
                page: 1,
                limit: 20,
                order: 'sort'
                ,
                userId: null,
                tCode: null,
                limitPayWay: null
                ,
                type: null
                ,
                name: null
                ,
                unit: null
                ,
                sales: null
                ,
                weight: null
                ,
                info: null
                ,
                title: null
                ,
                oldPrice: null
                ,
                nowPrice: null
                , shopPrice: null

                ,
                profit: null
                ,
                sort: null
                ,
                stock: null
                ,
                openSku: null
                ,
                shelf: null,
                mode: null,
                saleType: null,
                display: null,
                shopName: null,
                dailySel: null,
                dailySelRotation: null

            },
            saleTypeOptions: [{name: "优惠套餐", id: 0}],


            options: ["否", "是"],
            limitPayWay: ["不限制", "限制"],
            openSkuOptions: ["关闭", "开启"],
            openPriceOptions: ["关闭", "开启"],
            dispalyOptions: ["不可见", "可见"],
            dailySelOptions: ["关闭", "开启"],
            goodsShareOptions: ["活动信息", "卖点信息", "关闭"],
            shelfOptions: ["下架", "", "上架审核"],
            adminShelfOptions: ["下架", "上架", "待审核"],
            logTypeOptions: ["包邮", "满免", "计重"],
            tagTypes: ['info', '', 'warning', 'danger', 'warning'],
            stock: {
                goodsId: null,
                goodsName: null,
                oldQuantity: null,
                quantity: null,
                remark: null,
                skuName: null
            },
            saleTypeInfoEntity: {
                id: null,
                goodsId: null,
                transfer: null,
                delivery: null,
                point: null,
                maxVoucher: null,
                maxCoupon: null,
                maxClear: null,
                pointReward: null,
                pointType: null,
                couponReward: null,
                couponType: null,
                voucherReward: null,
                voucherType: null,
                cashReward: null,
                cashType: null,
                areaReward: null,
                areaType: null,
                managerReward: null,
                managerType: null,
                clearReward: null
            },
            flTypes: [],
            shopLogTemList: [],
            shopLogTems: ["新增物流模板"],
            pricesList: [],
            temp:
                {
                    id: null,
                    vip: null,
                    vipLevel: null,
                    vipProfit: null,
                    userId: null,
                    limitPayWay: null,
                    type: null,
                    levelName: null,
                    name: null,
                    remark: null,
                    unit: null,
                    sales: null,
                    weight: null,
                    perBox: null,
                    info: null,
                    title: null,
                    oldPrice: null,
                    totalStock: null,
                    shopPrice: null,
                    nowPrice: null,
                    profit: null,
                    profitPaw: null,
                    openSku: null,
                    openLevelPrice: null,
                    img: null,
                    bigImg: null,
                    shelf: null,
                    sort: null,
                    expDate: null,
                    logType: null,
                    fullNumber: null,
                    logFee: null,
                    reserve: null,
                    stock: 0,
                    midImg: null,
                    postImg: null,
                    prices: [],
                    saleType: null,
                    createTime: null,
                    guaranty: null,
                    discountInfo: null,
                    discountPrice: null,
                    actInfo: null,
                    buyTheme: null,
                    buyInfo: null,
                    supplyPrice: null,
                    display: null,
                    logTemId: null,
                    dailySelRotation: null,
                    dailySel: null,
                    shopEntity: null,

                },
            dialogFormVisible: false,
            dialogStockVisible: false,
            dialogStatus:
                '',
            textMap:
                {
                    update: '修改',
                    create:
                        '新增'
                }
            ,
            // 存在图片
            dialogImageUrl: '',
            dialogVisible: false,
            imgList: [],
            bigImgList: [],
            midImgList: [],
            postImgList: [],
            rules:
                {
                    cash_reward: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],

                    voucher_reward: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    logType: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    userId: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    type: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    name: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    expDate: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    createTime: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    transfer: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    delivery: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    guaranty: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    unit: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    saleType: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    weight: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    info: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    title: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    oldPrice: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    , shopPrice: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    nowPrice: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    profit: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    openSku: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'blur'
                        }
                    ]
                    ,
                    img: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    bigImg: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    shelf: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'blur'
                        }
                    ]
                    ,
                    sort: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    stock: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                    ,
                    midImg: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ], supplyPrice: [
                        {
                            required: true, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ],
                    postImg: [
                        {
                            required: false, message:
                                '必填字段', trigger:
                                'change'
                        }
                    ]
                }
            ,
            downloadLoading: false,
            qData:
                {
                    token: '',
                    key:
                        ''
                }
        }
    },
    created() {

        this.getList()
        // this.getShopLogTemList()
        //获取所有级别
        listAll().then(res => {
            this.levels = res.data
        })
        //获取所有的分类
        listType().then(res => {
            this.mallTypes = res.data
        })
    },
    computed: {
        getShopName() {
            return process.env.VUE_APP_SHOPNAME;
        },
        isWg() {
            return process.env.VUE_APP_SHOPNAME == '五集时代';
        },

        ...mapGetters([
            'perms'
        ]),
        canSave() {
            return hasAuth(this.perms, 'mall:goods:save')
        },
        canDelete() {
            return hasAuth(this.perms, 'mall:goods:delete')
        },
        canUpdate() {
            return hasAuth(this.perms, 'mall:goods:update')
        },
        canList() {
            return hasAuth(this.perms, 'mall:goods:list')
        }
    },
    methods: {
        selectPrice(index) {
            // this.cashReward = null
            // this.voucherReward = null
            // this.couponReward = null
            // this.maxCoupon = null
            // this.maxClear = null
            // this.voucherReward = null
            // this.temp.supplyPrice = 0
            // this.temp.shopPrice = 0
            // this.saleTypeInfoEntity.cashReward = null
            // this.saleTypeInfoEntity.voucherReward = null
            // this.saleTypeInfoEntity.couponReward = null
            // this.saleTypeInfoEntity.maxCoupon = null
            // this.saleTypeInfoEntity.maxClear = null
            // this.saleTypeInfoEntity.voucherReward = null
            // if (index == 5) {
            //   this.cashReward = this.temp.shopPrice ? this.temp.shopPrice * 0.1 : null;
            //   this.voucherReward = this.temp.shopPrice ? this.temp.shopPrice * 0.1 : null;
            // }
        },
        selectChange() {
            this.$router.push({path: '/bus/logTemplate', query: {}})
        },
        getShopLogTemList() {
            getList().then(res => {
                this.shopLogTemList = res.data
            })
        },
        handleAct() {
            if (this.goodsShare != null && this.goodsShare != "" && this.goodsShare == 0) {
                this.temp.buyTheme = null;
                this.temp.buyInfo = null;
            }
            if (this.goodsShare != null && this.goodsShare != "" && this.goodsShare == 1) {
                this.temp.discountInfo = null;
                this.temp.discountPrice = null;
                this.temp.actInfo = null;
            }
            if (this.goodsShare != null && this.goodsShare != "" && this.goodsShare == 2) {
                this.temp.discountInfo = null;
                this.temp.discountPrice = null;
                this.temp.actInfo = null;
                this.temp.buyTheme = null;
                this.temp.buyInfo = null;
            }
        },
        changeStockSku(name) {

            this.temp.mallSkus.forEach(sku => {

                if (sku.name == name) {
                    this.stock.oldQuantity = sku.stock
                }
            })
        },
        updateSku(themeList, skuList) {
            this.temp.skuThemes = themeList
            this.temp.mallSkus = skuList
        },
        getList() {
            this.listLoading = true
            list(this.listQuery).then(response => {
                this.list = response.data.list
                this.total = response.data.total
                this.userId = response.extra.userId
                this.roleId = response.extra.roleId
                this.goodsList = response.extra.goodsList
                this.levelList = response.extra.levelList
                this.listLoading = false

            })
        },
        handleFilter() {
            this.listQuery.type = this.types[1];
            this.listQuery.page = 1
            this.getList()
        },
        handleSizeChange(val) {
            this.listQuery.limit = val
            this.getList()
        },
        handleCurrentChange(val) {
            this.listQuery.page = val
            this.getList()
        },
        handleModifyStatus(row, status) {
            this.$message({
                message: '操作成功',
                type: 'success'
            })
            row.status = status
        },
        removePrices(idx) {
            this.pricesList.splice(idx, 1)
        },
        addPrices() {
            let initPrices = []
            this.levels.forEach(level => {
                let price = {
                    levelId: level.id,
                    levelName: level.name,
                    price: null,
                    profit: null,
                    vipCode: null,
                    vip: null,
                    vipProfit: null,
                    def: null
                }
                initPrices.push(price)
            })
            this.pricesList.push(initPrices)
        },
        beforeFormShow(row) {
            this.resetTemp(row) // 更新数据

            this.fenLeiTypes = [];
            this.province = 1
            this.city = 2
            this.area = 3
            this.shopReward = 5
            this.cashReward = null
            this.voucherReward = null
            this.clearReward = null
            this.couponReward = null
            this.maxClear = null
            this.maxCoupon = null
            this.saleTypeInfoEntity = {};
            this.bigTypes = [];
            this.goodsTemp = {}
            this.act = {}
            // this.$set(this.act, 'managerReward',5) // 响应的
            // 初始化price
            this.pricesList = []
            this.addPrices()
            this.goodsShare = null
            if (row) {
                info(row.id).then(res => {
                    this.resetTemp(res.data)
                    if (res.extra.pricesList.length > 0) {
                        this.pricesList = res.extra.pricesList
                    }
                    this.fenLeiTypes = res.extra.types;
                    if (res.extra.act) {
                        this.act = res.extra.act
                    }
                    if (this.fenLeiTypes != null && this.fenLeiTypes.length > 0) {
                        this.handleChange(this.fenLeiTypes)
                    }
                    if (this.temp.discountInfo != null && this.temp.discountInfo != "") {
                        this.goodsShare = 0;
                    }
                    if (this.temp.buyTheme != null && this.temp.buyTheme != "") {
                        this.goodsShare = 1;
                    }
                    this.goodsList = res.extra.goodsEntityList;
                    if (res.extra.saleTypeInfoEntity == null) {
                        this.saleTypeInfoEntity.transfer = 0;
                        this.saleTypeInfoEntity.delivery = 0;
                    } else {
                        this.saleTypeInfoEntity = res.extra.saleTypeInfoEntity;
                    }
                    if (this.saleTypeInfoEntity.managerReward == null || this.saleTypeInfoEntity.managerReward == '') {
                        this.shopReward = 5
                    } else {
                        this.shopReward = this.saleTypeInfoEntity.managerReward * 100;
                    }
                    // if (this.saleTypeInfoEntity.voucherReward != null && this.saleTypeInfoEntity.voucherReward != '') {
                    //   this.voucherReward = this.saleTypeInfoEntity.voucherReward.split("_")[1]
                    // }
                    // if (this.saleTypeInfoEntity.couponReward != null && this.saleTypeInfoEntity.couponReward != '') {
                    //   this.couponReward = this.saleTypeInfoEntity.couponReward.split("_")[1]
                    // }
                    // if (this.saleTypeInfoEntity.cashReward != null && this.saleTypeInfoEntity.cashReward != '') {
                    //   this.cashReward = this.saleTypeInfoEntity.cashReward.split("_")[1]
                    // }
                    // if (this.saleTypeInfoEntity.clearReward != null && this.saleTypeInfoEntity.clearReward != '') {
                    //   this.clearReward = this.saleTypeInfoEntity.clearReward.split("_")[1]
                    // }
                    // if (this.saleTypeInfoEntity.maxClear != null && this.saleTypeInfoEntity.maxClear != '') {
                    //   this.maxClear = this.saleTypeInfoEntity.maxClear
                    // }
                    // if (this.saleTypeInfoEntity.maxCoupon != null && this.saleTypeInfoEntity.maxCoupon != '') {
                    //   this.maxCoupon = this.saleTypeInfoEntity.maxCoupon
                    // }
                    if (this.saleTypeInfoEntity.areaReward != null && this.saleTypeInfoEntity.areaReward != '') {
                        this.province = this.saleTypeInfoEntity.areaReward.split("_")[0]
                        this.city = this.saleTypeInfoEntity.areaReward.split("_")[1]
                        this.area = this.saleTypeInfoEntity.areaReward.split("_")[2]
                    }
                    if (this.userId != null) {
                        this.temp.shelf = 0
                    }
                    if (res.extra.goodsQualificationEntity) {
                        this.goodsTemp = res.extra.goodsQualificationEntity;
                    }
                    this.fenLeiTypes.forEach(item => {
                        if (!this.bigTypes.includes(item[0])) {
                            this.bigTypes.push(item[0])
                        }
                    })
                    // for (let k = 0; k < this.pricesList.length; k++) {
                    // for (let i = 0; i < this.pricesList[k].length; i++) {
                    //   for (let j = 0; j < res.data.prices.length; j++) {
                    //     if (this.temp.prices[i].levelId == res.data.prices[j].levelId) {
                    //       this.temp.prices[i] = Object.assign(this.temp.prices[i], res.data.prices[j])
                    //     }
                    //   }
                    // }}
                    // for (let k = 0; k < this.pricesList.length; k++) {
                    //   for (let i = 0; i < this.pricesList[k].length; i++) {
                    //       for (let j = 0; j < res.data.prices.length; j++) {
                    //         if (this.pricesList[k][i].levelId == res.data.prices[j].levelId) {
                    //           this.pricesList[k][i] = Object.assign(this.pricesList[k][i], res.data.prices[j])
                    //         }
                    //       }
                    //   }
                    // }

                    //this.getLevels();
                    this.dialogStatus = 'update'
                    this.dialogFormVisible = true;
                    this.$nextTick(() => {
                        this.$refs['dataForm'].clearValidate()
                    })
                    // 存在图片字段转换图片地址显示
                    this.initImgUrl()
                })

            }


            // 存在图片
            this.initQiniu()
        },
        afterFormShow(row) {

        },
        beforeFormCommit() {
            this.initImgName()// 图片转换
            //   this.getLevel()
        },
        // getLevels() {
        //     if (this.act.level) {
        //         // this.temp.levels = this.temp.level.split("_")
        //         this.$set(this.act, "levels", this.act.level.split("_"))
        //     }
        // },
        // getLevel() {
        //     if (this.act.levels) {
        //         let str = '';
        //         this.act.levels.forEach(p => {
        //             str += p + '_'
        //         })
        //         this.act.level = str.substr(0, str.length - 1)
        //     }
        // },
        resetTemp(row) {
            if (row) {
                this.temp = Object.assign({}, row) // copy obj
            } else {
                this.temp = {prices: []}
            }

        },
        handleCreate() {

            this.beforeFormShow()
            // this.resetTemp()
            this.resetImgUrl()
            this.goodsShare = null
            this.dialogStatus = 'create'
            this.dialogStatus = 'create'
            this.dialogFormVisible = true
            this.$nextTick(() => {
                this.afterFormShow()
                this.$refs['dataForm'].clearValidate()
            })
        },
        goAct(row) {
            this.$router.push({
                path: '/wares/act', query: {
                    goodsId: row.id
                }
            })
        },
        handleDelete(row) {
            this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                // this.$message({
                //   type: 'success',
                //   message: '删除成功!'
                // })
                this.deleteData([row.id])
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                })
            })
        },
        // 显示将图片名封装成可以展示状态集合
        initImgUrl() {
            this.imgList = strsToList(this.temp.img, domain)
            this.bigImgList = strsToList(this.temp.bigImg, domain)
            this.midImgList = strsToList(this.temp.midImg, domain)
            this.postImgList = strsToList(this.temp.postImg, domain)
            this.brandBusinessLicenseList = strsToList(this.goodsTemp.brandBusinessLicense, domain)
            this.companyHealthLicenseList = strsToList(this.goodsTemp.companyHealthLicense, domain)
            this.manageHealthLicenseList = strsToList(this.goodsTemp.manageHealthLicense, domain)
            this.approveLicenseList = strsToList(this.goodsTemp.approveLicense, domain)
            this.produceLicenseList = strsToList(this.goodsTemp.produceLicense, domain)
            this.registerNoticeList = strsToList(this.goodsTemp.registerNotice, domain)
            this.manageLicenseList = strsToList(this.goodsTemp.manageLicense, domain)
            this.gmpLicenseList = strsToList(this.goodsTemp.gmpLicense, domain)
            this.trademarkLicenseList = strsToList(this.goodsTemp.trademarkLicense, domain)
            this.productAgreementList = strsToList(this.goodsTemp.productAgreement, domain)
            this.circulateLicenseList = strsToList(this.goodsTemp.circulateLicense, domain)
            this.betweenCirculateLicenseList = strsToList(this.goodsTemp.betweenCirculateLicense, domain)
            this.detectPhotocopyList = strsToList(this.goodsTemp.detectPhotocopy, domain)
            this.goodsDeclarationList = strsToList(this.goodsTemp.goodsDeclaration, domain)
            this.productListList = strsToList(this.goodsTemp.productList, domain)
            this.companyLicenseList = strsToList(this.goodsTemp.companyLicense, domain)
            this.entrustAgreementList = strsToList(this.goodsTemp.entrustAgreement, domain)
            this.qualityGuarantyList = strsToList(this.goodsTemp.qualityGuaranty, domain)
            this.healthPhotocopyList = strsToList(this.goodsTemp.healthPhotocopy, domain)
            this.fiveTrademarkList = strsToList(this.goodsTemp.fiveTrademark, domain)
            this.recordTableList = strsToList(this.goodsTemp.recordTable, domain)
            this.epidemicPreventionList = strsToList(this.goodsTemp.epidemicPrevention, domain)
            this.industryLicenseList = strsToList(this.goodsTemp.industryLicense, domain)
            this.salesAuthorizationList = strsToList(this.goodsTemp.salesAuthorization, domain)
            this.testProveList = strsToList(this.goodsTemp.testProve, domain)
            this.cccLicenseList = strsToList(this.goodsTemp.cccLicense, domain)
            this.goodsProveList = strsToList(this.goodsTemp.goodsProve, domain)
            this.brandAuthorizationList = strsToList(this.goodsTemp.brandAuthorization, domain)
        },
        // 关闭显示窗口 重置图片地址 防止错乱
        resetImgUrl() {
            this.imgList = []
            this.bigImgList = []
            this.midImgList = []
            this.postImgList = []
            this.brandBusinessLicenseList = []
            this.companyHealthLicenseList = []
            this.manageHealthLicenseList = []
            this.approveLicenseList = []
            this.produceLicenseList = []
            this.registerNoticeList = []
            this.manageLicenseList = []
            this.gmpLicenseList = []
            this.trademarkLicenseList = []
            this.productAgreementList = []
            this.circulateLicenseList = []
            this.betweenCirculateLicenseList = []
            this.detectPhotocopyList = []
            this.goodsDeclarationList = []
            this.productListList = []
            this.companyLicenseList = []
            this.entrustAgreementList = []
            this.qualityGuarantyList = []
            this.healthPhotocopyList = []
            this.fiveTrademarkList = []
            this.recordTableList = []
            this.epidemicPreventionList = []
            this.industryLicenseList = []
            this.salesAuthorizationList = []
            this.testProveList = []
            this.cccLicenseList = []
            this.goodsProveList = []
            this.brandAuthorizationList = []
        },
        // 上传或者更新的时候从图片链接中获取图片名字
        initImgName() {
            this.temp.img = listToStrs(this.imgList)
            this.temp.bigImg = listToStrs(this.bigImgList)
            this.temp.midImg = listToStrs(this.midImgList)
            this.temp.postImg = listToStrs(this.postImgList)
            this.goodsTemp.brandBusinessLicense = listToStrs(this.brandBusinessLicenseList)
            this.goodsTemp.companyHealthLicense = listToStrs(this.companyHealthLicenseList)
            this.goodsTemp.manageHealthLicense = listToStrs(this.manageHealthLicenseList)
            this.goodsTemp.approveLicense = listToStrs(this.approveLicenseList)
            this.goodsTemp.produceLicense = listToStrs(this.produceLicenseList)
            this.goodsTemp.registerNotice = listToStrs(this.registerNoticeList)
            this.goodsTemp.manageLicense = listToStrs(this.manageLicenseList)
            this.goodsTemp.gmpLicense = listToStrs(this.gmpLicenseList)
            this.goodsTemp.trademarkLicense = listToStrs(this.trademarkLicenseList)
            this.goodsTemp.productAgreement = listToStrs(this.productAgreementList)
            this.goodsTemp.circulateLicense = listToStrs(this.circulateLicenseList)
            this.goodsTemp.betweenCirculateLicense = listToStrs(this.betweenCirculateLicenseList)
            this.goodsTemp.detectPhotocopy = listToStrs(this.detectPhotocopyList)
            this.goodsTemp.goodsDeclaration = listToStrs(this.goodsDeclarationList)
            this.goodsTemp.productList = listToStrs(this.productListList)
            this.goodsTemp.companyLicense = listToStrs(this.companyLicenseList)
            this.goodsTemp.entrustAgreement = listToStrs(this.entrustAgreementList)
            this.goodsTemp.qualityGuaranty = listToStrs(this.qualityGuarantyList)
            this.goodsTemp.healthPhotocopy = listToStrs(this.healthPhotocopyList)
            this.goodsTemp.fiveTrademark = listToStrs(this.fiveTrademarkList)
            this.goodsTemp.recordTable = listToStrs(this.recordTableList)
            this.goodsTemp.epidemicPrevention = listToStrs(this.epidemicPreventionList)
            this.goodsTemp.industryLicense = listToStrs(this.industryLicenseList)
            this.goodsTemp.salesAuthorization = listToStrs(this.salesAuthorizationList)
            this.goodsTemp.testProve = listToStrs(this.testProveList)
            this.goodsTemp.cccLicense = listToStrs(this.cccLicenseList)
            this.goodsTemp.goodsProve = listToStrs(this.goodsProveList)
            this.goodsTemp.brandAuthorization = listToStrs(this.brandAuthorizationList)
        },
        initData() {
            if (!this.temp.stock) {
                this.temp.stock = 0
            }
        },
        createTempPrice() {
            this.temp.prices = []
            for (let i = 0; i < this.pricesList.length; i++) {
                this.temp.prices = this.temp.prices.concat(this.pricesList[i])
            }
        },
        createData() {
            this.$refs['dataForm'].validate((valid) => {
                    if (valid) {
                        this.beforeFormCommit()
                        this.temp['json'] = true
                        this.initData();


                            this.saleTypeInfoEntity.maxClear = null
                            this.saleTypeInfoEntity.clearReward = null
                            this.saleTypeInfoEntity.managerReward = this.shopReward / 100
                            if (this.province != null && this.province != '') {
                                this.saleTypeInfoEntity.areaReward = this.province
                            }
                            if (this.city != null && this.city != '') {
                                this.saleTypeInfoEntity.areaReward = this.saleTypeInfoEntity.areaReward + "_" + this.city
                            }
                            if (this.area != null && this.area != '') {
                                this.saleTypeInfoEntity.areaReward = this.saleTypeInfoEntity.areaReward + "_" + this.area
                            }
                            // if (this.voucherReward != null && this.voucherReward != '') {
                            //   this.saleTypeInfoEntity.voucherReward = "0_" + this.voucherReward
                            // }
                            // if (this.couponReward != null && this.couponReward != '') {
                            //   this.saleTypeInfoEntity.couponReward = "0_" + this.couponReward
                            // }
                            if (this.cashReward != null && this.cashReward != '') {
                                // this.saleTypeInfoEntity.cashReward = "0_" + this.cashReward
                            }
                            // if (this.maxCoupon != null && this.maxCoupon != '') {
                            //   this.saleTypeInfoEntity.maxCoupon = this.maxCoupon
                            // }

                        if (this.shopPrice != null && this.shopPrice != '') {
                            this.temp.shopPrice = this.shopPrice
                        }
                        if (this.clearReward != null && this.clearReward != '') {
                            this.saleTypeInfoEntity.clearReward = "0_" + this.clearReward
                        }
                        this.createTempPrice()
                        if(!this.temp.openLevelPrice){
                            this.temp.prices  = null
                        }
                        save(this.temp, this.saleTypeInfoEntity, this.flTypes, this.goodsTemp, this.act).then(res => {
                            this.temp = res.data
                            this.list.unshift(this.temp)
                            this.closeDialogForm()
                            this.$notify({
                                title: '成功',
                                message: '创建成功',
                                type: 'success',
                                duration: 2000
                            })
                        })
                    }
                }
            )
        },
        deleteData(ids) {
            // const ids = [this.temp.id]
            remove({ids: ids}).then(res => {
                // 从当前队列中移除
                for (const v of this.list) {
                    if (ids.indexOf(v.id) > -1) {
                        const index = this.list.indexOf(v)
                        this.list.splice(index, 1)
                        break
                    }
                }
                this.$notify({
                    title: '成功',
                    message: '删除成功',
                    type: 'success',
                    duration: 2000
                })
            })
        },
        handleStock(scope) {
            this.$index = scope.$index
            info(scope.row.id).then(res => {
                this.temp = Object.assign({}, res.data)
                this.stock.goodsName = this.temp.name
                this.stock.goodsId = this.temp.id
                this.stock.quantity = 0
                this.stock.remark = ""
                this.stock.skuName = ""
                this.stock.oldQuantity = this.temp.quantity ? this.temp.quantity : 0
                this.dialogStockVisible = true
            })


        },
        updateStock() {
            updateStock(this.stock).then(res => {
                this.dialogStockVisible = false
                this.$notify({
                    title: '成功',
                    message: '修改库存成功',
                    type: 'success',
                    duration: 2000
                })
                this.list.splice(this.$index, 1, res.data)
            })
        },
        handleUpdate(row) {
            console.log(row)
            this.beforeFormShow(row)
        },
        handleChange(value) {
            this.flTypes = value;
            let bigTypes = [];
            let fl = [];
            this.flTypes.forEach(item => {
                fl.push(item[1])
                bigTypes.push(item[0])
            })
            this.flTypes = fl;
            this.bigTypes = bigTypes

        },
        updateData() {
            this.$refs['dataForm'].validate((valid) => {
                    if (valid) {

                        this.beforeFormCommit()



                        this.temp['json'] = true
                        // this.temp.prices =this.prices

                        if (this.maxClear != null && this.maxClear != '') {
                            this.saleTypeInfoEntity.maxClear = this.maxClear
                        }
                        this.saleTypeInfoEntity.managerReward = this.shopReward / 100
                        if (this.province != null && this.province != '') {
                            this.saleTypeInfoEntity.areaReward = this.province
                        }
                        if (this.city != null && this.city != '') {
                            this.saleTypeInfoEntity.areaReward = this.saleTypeInfoEntity.areaReward + "_" + this.city
                        }
                        if (this.area != null && this.area != '') {
                            this.saleTypeInfoEntity.areaReward = this.saleTypeInfoEntity.areaReward + "_" + this.area
                        }
                        // if (this.voucherReward != null && this.voucherReward != '') {
                        //   this.saleTypeInfoEntity.voucherReward = "0_" + this.voucherReward
                        // }
                        // if (this.couponReward != null && this.couponReward != '') {
                        //   this.saleTypeInfoEntity.couponReward = "0_" + this.couponReward
                        // }
                        // if (this.cashReward != null && this.cashReward != '') {
                        //   this.saleTypeInfoEntity.cashReward = "0_" + this.cashReward
                        // }
                        // if (this.maxCoupon != null && this.maxCoupon != '') {
                        //   this.saleTypeInfoEntity.maxCoupon = this.maxCoupon
                        // }
                        // if (this.clearReward != null && this.clearReward != '') {
                        //   this.saleTypeInfoEntity.clearReward = "0_" + this.clearReward
                        // }
                        if (this.shopPrice != null && this.shopPrice != '') {
                            this.temp.shopPrice = this.shopPrice
                        }
                        if (this.userId != null) {
                            this.saleTypeInfoEntity.couponReward = 0
                        }
                        this.createTempPrice()
                        if(!this.temp.openLevelPrice){
                            this.temp.prices  = null
                        }
                        update(this.temp, this.saleTypeInfoEntity, this.flTypes, this.goodsTemp, this.act, this.adjustFlag).then((res) => {
                            for (const v of this.list) {
                                if (v.id === this.temp.id) {
                                    if (this.temp.id == res.data.id) {
                                        this.temp = res.data
                                    }
                                    const index = this.list.indexOf(v)
                                    this.list.splice(index, 1, this.temp)
                                    break
                                }
                            }

                            this.closeDialogForm()
                            this.$notify({
                                title: '成功',
                                message: '更新成功',
                                type: 'success',
                                duration: 2000
                            })
                        })
                    }
                }
            )
        },
        closeDialogForm() {
            // 存在图片
            this.resetImgUrl()
            this.fenLeiTypes = [];
            this.dialogFormVisible = false

        },
        handleDownload() {
            this.downloadLoading = true
            import('@/vendor/Export2Excel').then(excel => {
                const tHeader = [
                    '序号'
                    ,
                    '上传者的ID'
                    ,
                    '所属分类'
                    ,
                    '产品名字'
                    ,
                    '单位'
                    ,
                    '虚拟销量'
                    ,
                    '产品重量kg'
                    ,
                    '描述'
                    ,
                    '分享标题'
                    ,
                    '原价'
                    ,
                    '现价'
                    ,
                    '利润'
                    ,
                    '排序'
                    ,
                    '库存'
                    ,
                    '开启规格'
                    ,
                    '是否上架'
                ]
                const filterVal = ['id'
                    , 'userId'
                    , 'type'
                    , 'name'
                    , 'unit'
                    , 'sales'
                    , 'weight'
                    , 'info'
                    , 'title'
                    , 'oldPrice'
                    , 'nowPrice'
                    , 'profit'
                    , 'sort'
                    , 'stock'
                    ,
                    'openSku'
                    ,
                    'shelf'
                ]
                const data = this.formatJson(filterVal, this.list)
                excel.export_json_to_excel({
                    header: tHeader,
                    data,
                    filename: 'table-list'
                })
                this.downloadLoading = false
            })
        },
        formatJson(filterVal, jsonData) {
            return jsonData.map(v => filterVal.map(j => {
                    return v[j]
                }
            ))
        },
        // 存在图片
        handleUpload(file) {
            this.qData.key = new Date().valueOf() + file.name
        },
        initQiniu() {
            // 获取七牛配置
            getToken().then(res => {
                this.qData.token = res.data
            }).catch(error => {
                console.log(error)
            })
        },
        handleimgUploadSuccess(response, file, fileList) {
            this.imgList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlebigImgUploadSuccess(response, file, fileList) {
            this.bigImgList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlemidImgUploadSuccess(response, file, fileList) {
            this.midImgList.push({name: file.response.key, url: domain + file.response.key})
        },
        handlepostImgUploadSuccess(response, file, fileList) {
            this.postImgList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleimgRemove(file, fileList) {
            for (var fn of this.imgList) {
                if (fn.name === file.name) {
                    this.imgList.splice(this.imgList.indexOf(fn), 1)
                }
            }
        },
        handlebigImgRemove(file, fileList) {
            for (var fn of this.bigImgList) {
                if (fn.name === file.name) {
                    this.bigImgList.splice(this.bigImgList.indexOf(fn), 1)
                }
            }
        },
        handlemidImgRemove(file, fileList) {
            for (var fn of this.midImgList) {
                if (fn.name === file.name) {
                    this.midImgList.splice(this.midImgList.indexOf(fn), 1)
                }
            }
        },
        handlepostImgRemove(file, fileList) {
            for (var fn of this.postImgList) {
                if (fn.name === file.name) {
                    this.postImgList.splice(this.postImgList.indexOf(fn), 1)
                }
            }
        },
        handlePictureCardPreview(file) {
            this.dialogImageUrl = file.url
            this.dialogVisible = true
        },
        handlecompanyhealthLicenseUploadSuccess(response, file, fileList) {
            this.companyHealthLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlemanagehealthLicenseUploadSuccess(response, file, fileList) {
            this.manageHealthLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleapproveLicenseUploadSuccess(response, file, fileList) {
            this.approveLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleproduceLicenseUploadSuccess(response, file, fileList) {
            this.produceLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,

        handlemanageLicenseUploadSuccess(response, file, fileList) {
            this.manageLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlegmpLicenseUploadSuccess(response, file, fileList) {
            this.gmpLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handletrademarkLicenseUploadSuccess(response, file, fileList) {
            this.trademarkLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleproductAgreementUploadSuccess(response, file, fileList) {
            this.productAgreementList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlecirculateLicenseUploadSuccess(response, file, fileList) {
            this.circulateLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handledetectPhotocopyUploadSuccess(response, file, fileList) {
            this.detectPhotocopyList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlegoodsDeclarationUploadSuccess(response, file, fileList) {
            this.goodsDeclarationList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleproductListUploadSuccess(response, file, fileList) {
            this.productListList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlecompanyLicenseUploadSuccess(response, file, fileList) {
            this.companyLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleentrustAgreementUploadSuccess(response, file, fileList) {
            this.entrustAgreementList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlequalityGuarantyUploadSuccess(response, file, fileList) {
            this.qualityGuarantyList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlerecordTableUploadSuccess(response, file, fileList) {
            this.recordTableList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleepidemicPreventionUploadSuccess(response, file, fileList) {
            this.epidemicPreventionList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handleindustryLicenseUploadSuccess(response, file, fileList) {
            this.industryLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlesalesAuthorizationUploadSuccess(response, file, fileList) {
            this.salesAuthorizationList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handletestProveUploadSuccess(response, file, fileList) {
            this.testProveList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlecccLicenseUploadSuccess(response, file, fileList) {
            this.cccLicenseList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlegoodsProveUploadSuccess(response, file, fileList) {
            this.goodsProveList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlebrandAuthorizationUploadSuccess(response, file, fileList) {
            this.brandAuthorizationList.push({name: file.response.key, url: domain + file.response.key})
        }
        ,
        handlecompanyhealthLicenseRemove(file, fileList) {
            for (var fn of this.companyHealthLicenseList) {
                if (fn.name === file.name) {
                    this.companyHealthLicenseList.splice(this.companyHealthLicenseList.indexOf(fn), 1)
                }
            }
        },
        handlemanagehealthLicenseRemove(file, fileList) {
            for (var fn of this.manageHealthLicenseList) {
                if (fn.name === file.name) {
                    this.manageHealthLicenseList.splice(this.manageHealthLicenseList.indexOf(fn), 1)
                }
            }
        },
        handleapproveLicenseRemove(file, fileList) {
            for (var fn of this.approveLicenseList) {
                if (fn.name === file.name) {
                    this.approveLicenseList.splice(this.approveLicenseList.indexOf(fn), 1)
                }
            }
        },
        handleproduceLicenseRemove(file, fileList) {
            for (var fn of this.produceLicenseList) {
                if (fn.name === file.name) {
                    this.produceLicenseList.splice(this.produceLicenseList.indexOf(fn), 1)
                }
            }
        },
        handlemanageLicenseRemove(file, fileList) {
            for (var fn of this.manageLicenseList) {
                if (fn.name === file.name) {
                    this.manageLicenseList.splice(this.manageLicenseList.indexOf(fn), 1)
                }
            }
        },
        handlegmpLicenseRemove(file, fileList) {
            for (var fn of this.gmpLicenseList) {
                if (fn.name === file.name) {
                    this.gmpLicenseList.splice(this.gmpLicenseList.indexOf(fn), 1)
                }
            }
        },
        handletrademarkLicenseRemove(file, fileList) {
            for (var fn of this.trademarkLicenseList) {
                if (fn.name === file.name) {
                    this.trademarkLicenseList.splice(this.trademarkLicenseList.indexOf(fn), 1)
                }
            }
        },
        handleproductAgreementRemove(file, fileList) {
            for (var fn of this.productAgreementList) {
                if (fn.name === file.name) {
                    this.productAgreementList.splice(this.productAgreementList.indexOf(fn), 1)
                }
            }
        },
        handlecirculateLicenseRemove(file, fileList) {
            for (var fn of this.circulateLicenseList) {
                if (fn.name === file.name) {
                    this.circulateLicenseList.splice(this.circulateLicenseList.indexOf(fn), 1)
                }
            }
        },
        handledetectPhotocopyRemove(file, fileList) {
            for (var fn of this.detectPhotocopyList) {
                if (fn.name === file.name) {
                    this.detectPhotocopyList.splice(this.detectPhotocopyList.indexOf(fn), 1)
                }
            }
        },
        handlegoodsDeclarationRemove(file, fileList) {
            for (var fn of this.goodsDeclarationList) {
                if (fn.name === file.name) {
                    this.goodsDeclarationList.splice(this.goodsDeclarationList.indexOf(fn), 1)
                }
            }
        },
        handleproductListRemove(file, fileList) {
            for (var fn of this.productListList) {
                if (fn.name === file.name) {
                    this.productListList.splice(this.productListList.indexOf(fn), 1)
                }
            }
        },
        handlecompanyLicenseRemove(file, fileList) {
            for (var fn of this.companyLicenseList) {
                if (fn.name === file.name) {
                    this.companyLicenseList.splice(this.companyLicenseList.indexOf(fn), 1)
                }
            }
        },
        handleentrustAgreementRemove(file, fileList) {
            for (var fn of this.entrustAgreementList) {
                if (fn.name === file.name) {
                    this.entrustAgreementList.splice(this.entrustAgreementList.indexOf(fn), 1)
                }
            }
        },
        handlequalityGuarantyRemove(file, fileList) {
            for (var fn of this.qualityGuarantyList) {
                if (fn.name === file.name) {
                    this.qualityGuarantyList.splice(this.qualityGuarantyList.indexOf(fn), 1)
                }
            }
        },
        handlerecordTableRemove(file, fileList) {
            for (var fn of this.recordTableList) {
                if (fn.name === file.name) {
                    this.recordTableList.splice(this.recordTableList.indexOf(fn), 1)
                }
            }
        },
        handleepidemicPreventionRemove(file, fileList) {
            for (var fn of this.epidemicPreventionList) {
                if (fn.name === file.name) {
                    this.epidemicPreventionList.splice(this.epidemicPreventionList.indexOf(fn), 1)
                }
            }
        },
        handleindustryLicenseRemove(file, fileList) {
            for (var fn of this.industryLicenseList) {
                if (fn.name === file.name) {
                    this.industryLicenseList.splice(this.industryLicenseList.indexOf(fn), 1)
                }
            }
        },
        handlesalesAuthorizationRemove(file, fileList) {
            for (var fn of this.salesAuthorizationList) {
                if (fn.name === file.name) {
                    this.salesAuthorizationList.splice(this.salesAuthorizationList.indexOf(fn), 1)
                }
            }
        },
        handletestProveRemove(file, fileList) {
            for (var fn of this.testProveList) {
                if (fn.name === file.name) {
                    this.testProveList.splice(this.testProveList.indexOf(fn), 1)
                }
            }
        },
        handlecccLicenseRemove(file, fileList) {
            for (var fn of this.cccLicenseList) {
                if (fn.name === file.name) {
                    this.cccLicenseList.splice(this.cccLicenseList.indexOf(fn), 1)
                }
            }
        },
        handlegoodsProveRemove(file, fileList) {
            for (var fn of this.goodsProveList) {
                if (fn.name === file.name) {
                    this.goodsProveList.splice(this.goodsProveList.indexOf(fn), 1)
                }
            }
        },
        handlebrandAuthorizationRemove(file, fileList) {
            for (var fn of this.brandAuthorizationList) {
                if (fn.name === file.name) {
                    this.brandAuthorizationList.splice(this.brandAuthorizationList.indexOf(fn), 1)
                }
            }
        },

    }
}
</script>
